Where ORDER is a whole number from 2 to 7 inclusively that specifies the order of the equation. T1, T2... Tm are float values for the coefficients of the equation. There are "m" such terms where
An alternate way to specify 3rd order polys is:
Also 4th order equations may be specified with:
Here's a more mathematical description of quartics for those who are interested. Quartic surfaces are 4th order surfaces, and can be used to describe a large class of shapes including the torus, the lemniscate, etc. The general equation for a quartic equation in three variables is (hold onto your hat):
a00 x^4 + a01 x^3 y + a02 x^3 z+ a03 x^3 + a04 x^2 y^2+ a05 x^2 y z+ a06 x^2 y + a07 x^2 z^2+a08 x^2 z+a09 x^2+ a10 x y^3+a11 x y^2 z+ a12 x y^2+a13 x y z^2+a14 x y z+ a15 x y + a16 x z^3 + a17 x z^2 + a18 x z + a19 x+ a20 y^4 + a21 y^3 z + a22 y^3+ a23 y^2 z^2 +a24 y^2 z+ a25 y^2 + a26 y z^3 + a27 y z^2 + a28 y z + a29 y+ a30 z^4 + a31 z^3 + a32 z^2 + a33 z + a34 = 0
To declare a quartic surface requires that each of the coefficients (a0 -> a34) be placed in order into a single long vector of 35 terms.
As an example let's define a torus the hard way. A Torus can be represented by the equation:
x^4 + y^4 + z^4 + 2 x^2 y^2 + 2 x^2 z^2 + 2 y^2 z^2 - 2 (r0^2 + r1^2) x^2 + 2 (r0^2 - r1^2) y^2 - 2 (r0^2 + r1^2) z^2 + (r0^2 - r1^2)^2 = 0
Where r0 is the "major" radius of the torus, the distance from the hole of the donut to the middle of the ring of the donut, and r1 is the "minor" radius of the torus, the distance from the middle of the ring of the donut to the outer surface. The following object declaration is for a torus having major radius 6.3 minor radius 3.5 (Making the maximum width just under 20).
Poly, cubic and quartics are just like quadrics in that you don't have to understand what one is to use one. The file SHAPESQ.INC has plenty of pre-defined quartics for you to play with. The syntax for using a pre-defined quartic is:
As with the other shapes, these shapes can be translated, rotated, and scaled. Because they are (almost always) infinite they do not respond to automatic bounding. They can be used freely in CSG because they have a clear defined "inside".
Polys use highly complex computations and will not always render perfectly. If the surface is not smooth, has dropouts, or extra random pixels, try using the optional keyword "sturm" in the definition. This will cause a slower, but more accurate calculation method to be used. Usually, but not always, this will solve the problem. If sturm doesn't work, try rotating, or translating the shape by some small amount. See the sub-directory MATH for examples of polys in scenes.
"The CRC Handbook of Mathematical Curves and Surfaces" David von Seggern CRC Press 1990
A quadric is defined in POV-Ray by:
where A through J are float expressions.
This defines a surface of x,y,z points which satisfy the equation:
A x^2 + B y^2 + C z^2 + D xy + E xz + F yz + G x + H y + I z + J = 0
Different values of A,B,C,...J will give different shapes. So, if you take any three dimensional point and use its x, y, and z coordinates in the above equation, the answer will be 0 if the point is on the surface of the object. The answer will be negative if the point is inside the object and positive if the point is outside the object. Here are some examples:
X^2 + Y^2 + Z^2 - 1 = 0 Sphere X^2 + Y^2 - 1 = 0 Infinite cylinder along the Z axis X^2 + Y^2 - Z^2 = 0 Infinite cone along the Z axis
The easiest way to use these shapes is to include the standard file "SHAPES.INC" into your program. It contains several pre-defined quadrics and you can transform these pre-defined shapes (using translate, rotate, and scale) into the ones you want.
You can invoke them by using the syntax,
The pre-defined quadrics are centered about the origin <0, 0, 0> and have a radius of 1. Don't confuse radius with width. The radius is half the diameter or width making the standard quadrics 2 units wide.
Some of the pre-defined quadrics are,
Ellipsoid Cylinder_X, Cylinder_Y, Cylinder_Z QCone_X, QCone_Y, QCone_Z Paraboloid_X, Paraboloid_Y, Paraboloid_Z
For a complete list, see the file SHAPES.INC.
CSG is based on the three boolean operations and, or and negate.
CSG shapes may be used in CSG shapes. In fact, CSG shapes may be used anyplace that a standard shape is used.
The order of the component shapes with the CSG doesn't matter except in a difference shape. For CSG differences, the first shape is visible and the remaining shapes are cut out of the first.
Constructive solid geometry shapes may be translated, rotated, or scaled in the same way as any shape. The shapes making up the CSG shape may be individually translated, rotated, and scaled as well.
When using CSG, it is often useful to invert a shape so that it's inside-out. The appearance of the shape is not changed, just the way that POV-Ray perceives it. The inverse keyword can be used to do this for any shape.
Given any point in space, you can say it's either inside or outside any particular primitive object (well, it could be exactly on the surface, but numerical inaccuracies will put it to one side or the other).
Even planes have an inside and an outside. By definition, the surface normal of the plane points towards the outside of the plane. (For a simple floor, for example, the space above the floor is "outside" and the space below the floor is "inside". For simple floors this in un-important, but for planes as parts of CSG's it becomes much more important). CSG uses the concepts of inside and outside to combine shapes together. Take the following situation:
Note: The diagrams shown here demonstrate the concepts in 2D and are intended only as an analogy to the 3D case.
Note that the triangles and triangle-based shapes cannot be used as solid objects in CSG since they have no clear inside and outside.
In this diagram, point 1 is inside object A only. Point 2 is inside B only. Point 3 is inside both A and B while point 0 is outside everything.
Unions are simply "glue", used to bind two or more shapes into a single entity that can be manipulated as a single object. The image above shows the union of A and B. The new object created by the union operation can then be scaled, translated, and rotated as a single shape. The entire union can share a single texture, but each object contained in the union may also have its own texture, which will override any matching texture statements in the parent object.
This union will contain three spheres. The first sphere is explicitly colored Red while the other two will be shiny blue. Note that the shiny finish does NOT apply to the first sphere. This is because the "pigment {Red}" is actually shorthand for "texture {pigment {Red}}". It attaches an entire texture with default normals and finish. The textures or pieces of textures attached to the union apply ONLY to components with no textures. These texturing rules also apply to intersection, difference and merge as well.
Earlier versions of POV-Ray placed restrictions on unions so you often had to combine objects with composite statements. Those earlier restrictions have been lifted so composite is no longer needed. Composite is still supported for backwards compatibility but it is recommended that union now be used in it's place since future support for the composite keyword is not guaranteed.
For example:
For example:
The different type of light sources and the optional modifiers are described in the following sections.
The syntax is:
The spotlight is identified by the "spotlight" keyword. Its located at CENTER and points at POINT. The following illustrations will be helpful in understanding how these values relate to each other:
Spotlights also have three other parameters: radius, falloff, and tightness.
The tightness value specifies how quickly the light dims, or falls off, in the region between the radius (full brightness inside) cone and the falloff (full darkness outside) cone. The default value for tightness is 10. Lower tightness values will make the spot have very soft edges. High values will make the edges sharper, the spot "tighter". Values from 1 to 100 are acceptable.